/*
 * Ina226App.h
 *
 *  Created on: 2021��7��25��
 *      Author: vicent-PC
 */

#ifndef MAIN_POWER_TRACK_INA226APP_H_
#define MAIN_POWER_TRACK_INA226APP_H_
#include "INA226.h"

#define INA226_I2C_ADDR (0x40)

class Ina226App {
public:
	Ina226App() {};
	Ina226App(I2cInterface intf);
	virtual ~Ina226App();
	void checkConfig();
	int setup();
	void main();
	void pollIVP();
	void getVol_Power(float& cur_vol, float& vol_ref, float& power_ref);
	void getIVP(float& cur, float& vol, float& power);
    void fastGetIVP(float& cur, float& vol, float& power);

private:
	INA226 ina;
	I2cInterface i2cIntf;
	bool i2cIntfInited = false;
	float mBus_vol_avg_ref = 0;
	float mBus_vol_avg_cur = 0;
	float mBus_vol_avg_power_ref = 0;

	float mI = 0;
	float mV = 0;
	float mP = 0;
};

#endif /* MAIN_POWER_TRACK_INA226APP_H_ */
